package inph.account.dao;

import inph.account.common.JpaUtil;

import javax.persistence.EntityManager;

public class BaseDao {
	EntityManager em = null;
	boolean isOutEm = false;
	
	public EntityManager getEm() {
		if(em==null)
			em = JpaUtil.getEntityManager();
		return em;
	}

	public void setEm(EntityManager em) {
		isOutEm = true;
		this.em = em;
	}
	
	public void closeEm(){
		if(isOutEm)
			getEm().close();
	}
}
